﻿var status = 0;

var time = java.util.Calendar.getInstance();
var year = time.get(java.util.Calendar.YEAR); //获得年份
var month = time.get(java.util.Calendar.MONTH) + 1; //获得月份
var day = time.get(java.util.Calendar.DATE); //获取日
var hour = time.get(java.util.Calendar.HOUR_OF_DAY); //获得小时
var minute = time.get(java.util.Calendar.MINUTE); //获得分钟
var second = time.get(java.util.Calendar.SECOND); //获得秒
var tz20 = "#fEffect/CharacterEff/1114000/1/0#"; //红星花
//var eff1 = "#fUI/StarCityUI.img/GradeInfo/icon_ss/7#"
var eff1 = "#fEffect/CharacterEff/1112949/3/0#"; //花样音符
//var eff1 = "#fUI/StarCityUI.img/GradeInfo/icon_ss/7#"
var z = "#fUI/UIWindow/Quest/icon5/1#"; //"+z+"//美化
var kkk = "#fEffect/CharacterEff/1051296/1/0#";
var p2 = "#fUI/SoulUI.img/DungeonMap/icon/dungeonItem/0#"
	var tz12 = "#fEffect/CharacterEff/1112924/0/0#"; //黄星
var tz13 = "#fEffect/CharacterEff/1112925/0/0#"; //蓝星

function start() {
	status = -1;
	action(1, 0, 0);
}

function action(mode, type, selection) {
	if (status == 0 && mode == 0) {
		cm.dispose();
		return;
	}
	if (mode == 1) {
		status++;
	} else {
		status--;
	}

	if (cm.getPlayer().getSkillLevel(8) <= 0 || cm.getPlayer().getSkillLevel(10000018) <= 0 || cm.getPlayer().getSkillLevel(20000024) <= 0 || cm.getPlayer().getSkillLevel(20011024) <= 0) {
		if (cm.getJob() == 2001 || (cm.getJob() >= 2200 && cm.getJob() <= 2218)) {
			cm.teachSkill(20011024, 1, 0); // 龙神 - 群宠
		} else if (cm.getJob() == 2000 || (cm.getJob() >= 2100 && cm.getJob() <= 2112)) {
			cm.teachSkill(20000024, 1, 0); // 战神 - 群宠
		} else if (cm.getJob() >= 1000 && cm.getJob() <= 1512) {
			cm.teachSkill(10000018, 1, 0); // 骑士团 - 群宠
		} else {
			cm.teachSkill(8, 1, 0); // 冒险家 - 群宠
		}
	}
	if (cm.getMapId() == 180000001) {
		cm.sendOk("很遗憾，您因为违反用户守则被禁止游戏活动，如有异议请联系管理员.")
		cm.dispose();
	} else if (status == 0) {
		var selStr = "\t" + "欢迎来到" + cm.getServerName() + "冒险岛.以下是便民服务区#k\r\n";

		var selStr = "" + tz13 + "#d在线：#r" + cm.getPlayer().getTodayOnlineTime() + "#d 分钟 " + tz13 + "余额：#r" + cm.getHyPay(1) + "#d   " + tz13 + "#d组队积分为：#r" + cm.getPlayerPoints() + "#k点         " + tz13 + "#d点卷：#r" + cm.getPlayer().getCSPoints(1) + "#d        \t" + tz13 + "抵用券：#r" + cm.getPlayer().getCSPoints(2) + "#k\r\n #e#d当前时间" + hour + ":" + minute + ":" + second + "#k\r\n"

			selStr += "#L1#" + eff1 + "#r返回市场#l"; ;
		selStr += "#L100#" + "#r	#l"; ;
		selStr += "#L0#" + eff1 + "#r进入商城#l\r\n\r\n";

		selStr += "" + tz20 + "" + tz12 + "" + tz13 + tz20 + "" + tz12 + "" + tz13 + tz20 + "" + tz12 + "" + tz13 + tz20 + "" + tz12 + "" + tz13 + tz20 + "" + tz12 + "" + tz13 + tz20 + "" + tz12 + "" + tz13 + tz20 + "" + tz12 + "" + tz13 + "\r\n";

		selStr += "#L2#" + tz13 + "#d个人中心#l";
		selStr += "#L3#" + tz13 + "#d游戏中心#l";
		selStr += "#L4#" + tz13 + "#d万能传送#l\r\n\r\n";

		selStr += "#L5#" + tz13 + "#r游戏商店#l";
		selStr += "#L6#" + tz13 + "#r点卷商城#l";
		selStr += "#L7#" + tz13 + "#r抵用商店\r\n\r\n";

		//selStr += "#L9#" + tz13 + "#g功能区啊#l";
		//selStr += "#L10#" + tz13 + "#g功能区啊#l";
		//selStr += "#L11#" + tz13 + "#g功能区啊\r\n\r\n";


		selStr += "" + tz20 + "" + tz12 + "" + tz13 + tz20 + "" + tz12 + "" + tz13 + tz20 + "" + tz12 + "" + tz13 + tz20 + "" + tz12 + "" + tz13 + tz20 + "" + tz12 + "" + tz13 + tz20 + "" + tz12 + "" + tz13 + tz20 + "" + tz12 + "" + tz13 + "\r\n";

		selStr += "#L8#" + tz13 + "#r回收分解系统#l";
		selStr += "#L12#" + tz13 + "#r神秘徽章#l\r\n\r\n";

		cm.sendSimple(selStr);
	} else if (status == 1) {
		switch (selection) {

		case 0: //商城系统
			cm.dispose();
			cm.EnterCS();
			break;
		case 1: //返回市场
			cm.dispose();
			cm.openNpc(9310382, 0);
			break;
		case 2: //个人中心
			cm.dispose();
			cm.openNpc(0, "个人中心");
			break;
		case 3: //游戏中心
			cm.dispose();
			cm.openNpc(0, "游戏中心");
			break;
		case 4: //万能传送
			cm.dispose();
			cm.openNpc(0, "万能传送");
			break;
		case 5: //商店专区
			cm.dispose();
			cm.openNpc(0, "游戏商店");
			break;
		case 6: //点卷商城
			cm.dispose();
			cm.openNpc(0, "点卷商城");
			break;
		case 7: //抵用商店
			cm.dispose();
			cm.openNpc(0, "抵用商城");
			break;
		case 8: //功能区
			cm.dispose();
			cm.openNpc(9400496);
			break;
		case 9: //回收分解
			cm.dispose();
			cm.openNpc(0, "游戏功能");
			break;
		case 10: //回收分解
			cm.dispose();
			cm.openNpc(0, "抵用商城");
			break;
		case 11: //回收分解
			cm.dispose();
			cm.openNpc(0, "抵用商城");
			break;
		case 12:
			if (cm.haveItem(1712001, 1, true, true)) {
				cm.sendOk("你已经有神秘徽章了");
			} else if (cm.getPlayer().getLevel() >= 200) {
				var ii = cm.getItemInfo();
				var toDrop = ii.randomizeStats(ii.getEquipById(1712001), cm.getPlayer()).copy();
				toDrop.setStr(100); //装备力量
				toDrop.setDex(100); //装备敏捷
				toDrop.setInt(100); //装备智力
				toDrop.setLuk(100); //装备运气
				toDrop.setARC(100);
				cm.addFromDrop(cm.getC(), toDrop, false);
				cm.sendOk("领取成功");
			} else {
				cm.sendOk("你还没有200级")
			}
			cm.dispose();
			break;
		}
	}
}
